#define quickread
#ifdef quickread
#include <cstdio> 
template <typename T>
inline void read(T& x)
{
    int c=getchar(), f=1; x=0;
    while(c<'0'||'9'<c) {if(c=='-') f=-1; c=getchar();}
    while('0'<=c&&c<='9') 
        x=(x<<3)+(x<<1)+c-'0', c=getchar();
    x*=f;
}
template <typename T>
inline void quickwrite(T x)
{
    if(x<0) putchar('-'), x*=-1;
    if(x>=10) quickwrite(x/10);
    putchar(x%10+'0');
}
#else 
#include <iostream>
#endif
#include <cstring>
using namespace std;
#define DEBUG
int n, root;
struct Node{
    int fa, lchild, rchild;   
}tree[30];

void init()
{
    memset(tree, -1, sizeof tree);
    read(n);
    for(int i=1; i<=n; i++)
    {
        char str[4]; scanf("%s", str);
        if(i==1) root=str[0]-'a';
        int u=str[0]-'a';
        if(str[1]!='*') tree[u].lchild=str[1]-'a';
        if(str[2]!='*') tree[u].rchild=str[2]-'a';
        tree[tree[u].lchild].fa=tree[tree[u].lchild].fa=u;
    }
}

void pre(int u)
{
    // quickwrite(u+'a');
    printf("%c", u+'a');
    if(tree[u].lchild!=-1) pre(tree[u].lchild);
    if(tree[u].rchild!=-1) pre(tree[u].rchild);

}

void solve()
{
    init();
    pre(root);
    printf("\n");
}

// #undef DEBUG
signed main()
{
    #ifdef DEBUG
        freopen("./in.txt", "r", stdin);
        // freopen("./out.txt", "w", stdout);
    #endif
    #ifndef quickread
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    #endif

    int T=1; //scanf("%d", &T);
    while(T--) 
    {
        solve();
    }
    return 0;
}
